const mixins = require('../../mixins/forum')
const common = require('../../mixins/common')
import config from "../../api/config";
const app = getApp()
const options = {
  /**
   * 页面的初始数据
   */
  data: {
    page:1,
    isLastPage:false,
    posts:[],
    type:'circle',
    isAudit:true,
    currentConfig:config.currentConfig,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options)
    this.setData({
      id: options.id,
    })
    this.getCircleByIDs(options.id);
    this.getCircleAudit();
  },

  

  bouncedTap:function(){
    this.setData({
      bounced: false,
    })
  },

  onClickCancle:function(){
    this.setData({
      showDialog: false,
    })
  },

  
  /**
   * 显示删除菜单
   */

  editOrDeleteTap: function () {
    this.setData({
      showDialog: !this.data.showDialog,
      bounced: !this.data.bounced
    })
  },


  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    let user = app.globalData.user
    if (!user) {
      user = '';
    }
    this.setData({
      user: user,
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    this.setData({
      page:1,
      isLastPage:false,
      posts:[],
    })
    this.getCircleAudit();
    wx.stopPullDownRefresh();
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    this.setData({
      isBottom: true
    })
    if (!this.data.isLastPage) {
      this.getCircleAudit({
        page: this.data.page,
      });
    }
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
}

mixins(options)
common(options)
Page(options)